<?php

class Comment extends API_Controller {

    public function __construct() {
        parent::__construct();
        $this->load->model('comment_model');
    }

    public function index() {
        $params = $this->params;
        if (empty($params['fb_id']) == TRUE) {
            $this->response('INVALID_PARAMS');
        }

        $args['fb_id'] = intval($params['fb_id']);
        $key = empty($params['key']) == TRUE ? NULL : $params['key'];

        $args['type'] = 1;
        $this->data['comment_wall'] = $this->comment_model->get_active($args, $key);
        $args['type'] = 2;
        $this->data['comment_group'] = $this->comment_model->get_active($args, $key);
        $args['type'] = 3;
        $this->data['comment_random'] = $this->comment_model->get_active($args, $key);
        
        if (empty($result) == FALSE) {
            $this->response('GET_SUCCESS', $result);
        } else {
            $this->response('GET_FAIL', $result);
        }
    }

}
